-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Explore] Altered Slice Tag #3668
[Explore] Altered Slice Tag #3668
Conversation
1 similar comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking forward to this feature!
@@ -145,6 +146,25 @@ class ChartContainer extends React.PureComponent { | |||
}; | |||
} | |||
|
|||
isAltered() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using a deep equality function like http://underscorejs.org/#isEqual instead?
} | ||
} | ||
|
||
AlteredSliceTag.propTypes = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please put propTypes
at the top of the file as in most other modules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also what about if the component received origFormData
and currentFormData
instead, and the logic to check the differences can live in this component here.
differing[fdKey] = { before: bfd[fdKey], after: fd[fdKey] }; | ||
} | ||
} | ||
return differing; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd expect a isSomething
method to return a bool by naming conventions, rename the function to something like getDiffs
.
} else if (value.constructor === Object) { | ||
return JSON.stringify(value); | ||
} | ||
return value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking the catchall could be a JSON.stringify
though I'm not 100 sure of the implications. There's a guarantee that controls' values are always serializable since they make it through the redux store.
// Returns all properties that differ in the | ||
// current form data and the base form data | ||
const fd = this.props.formData || {}; | ||
const bfd = (this.props.slice && this.props.slice.form_data) || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you may want to use the currentFormData
as the driver of which keys should exist. slice.form_data
may have unused / deprecated keys that don't affect how the slice is rendered...
Putting |
28a3fea
to
5154c0a
Compare
Coverage increased (+0.06%) to 70.819% when pulling 16f175767899dc6af24b5a28bcecf36e6b69abbe on Mogball:mogball/feature/altered_explore_slice into e121a85 on apache:master. |
1 similar comment
Coverage increased (+0.06%) to 70.819% when pulling 16f175767899dc6af24b5a28bcecf36e6b69abbe on Mogball:mogball/feature/altered_explore_slice into e121a85 on apache:master. |
16f1757
to
5154c0a
Compare
31a9d5e
to
5154c0a
Compare
09f333c
to
2e83588
Compare
2 similar comments
Ok this is ready to merge upon fixing conflicts. |
Coverage decreased (-0.08%) to 71.376% when pulling e1ba9c50b481ee521d3715581cb5239f4f7bee14 on Mogball:mogball/feature/altered_explore_slice into 6c52f2f on apache:master. |
e1ba9c5
to
c364a40
Compare
c364a40
to
c7a3c49
Compare
Coverage increased (+0.06%) to 71.517% when pulling c364a403ac639aa73b74e124488544aec980339c on Mogball:mogball/feature/altered_explore_slice into 6c52f2f on apache:master. |
Coverage increased (+0.06%) to 71.517% when pulling c364a403ac639aa73b74e124488544aec980339c on Mogball:mogball/feature/altered_explore_slice into 6c52f2f on apache:master. |
2 similar comments
Coverage increased (+0.06%) to 71.517% when pulling c364a403ac639aa73b74e124488544aec980339c on Mogball:mogball/feature/altered_explore_slice into 6c52f2f on apache:master. |
Coverage increased (+0.06%) to 71.517% when pulling c364a403ac639aa73b74e124488544aec980339c on Mogball:mogball/feature/altered_explore_slice into 6c52f2f on apache:master. |
2 similar comments
@mistercrunch done |
* Added altered tag to explore slice view and fixes apache#3616 * unit tests * Moved getDiffs logic into AlteredSliceTag * code style fixs
* Added altered tag to explore slice view and fixes apache#3616 * unit tests * Moved getDiffs logic into AlteredSliceTag * code style fixs
Based on a suggesting by @mistercrunch in #3617, this PR implements an
AlteredSliceTag
which is displayed next to the slice title in theexplore
view when the current controls do not match the saved slice controls:Users can click the tag to open a modal summarizing the differences:
Most importantly, exploring a slice from a dashboard with dashboard filters will show the slice as
altered
with the applied filters as differences.Also fixes #3616